package com.itheima;

import com.itheima.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class UserApp {
    public static void main(String[] args) {
        //加载配置文件
    /*    ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        //获取资源
        UserService userService = (UserService) ctx.getBean("userService");
        userService.save();
        */

     /*   ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        //获取资源
        UserService userService1 = (UserService) ctx.getBean("userService2");
        UserService userService2 = (UserService) ctx.getBean("userService2");
        System.out.println(userService1);
        System.out.println(userService2);
        */

        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        //获取资源
        UserService userService1 = (UserService) ctx.getBean("userService3");
        UserService userService2 = (UserService) ctx.getBean("userService3");
       ctx.close();


    }
}
